package com.tydic.borderer.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.tydic.borderer.domain.AgentContract;
import com.tydic.borderer.mapper.AgentContractMapper;
import com.tydic.borderer.service.IAgentContractService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@Slf4j
@RequiredArgsConstructor
public class AgentContractServiceImpl implements IAgentContractService {
    private final AgentContractMapper agentContractMapper;

    @Override
    public AgentContract getByAgentId(String id) {
        return agentContractMapper.selectOne(Wrappers.lambdaQuery(AgentContract.class).eq(AgentContract::getAgentId, id).orderByDesc(AgentContract::getId), false);
    }

    @Override
    public List<AgentContract> getByDocId(String docId) {
        return agentContractMapper.selectList(Wrappers.lambdaQuery(AgentContract.class).eq(AgentContract::getDocId, docId));
    }
}
